import { defineStore } from 'pinia'
import piniaPersistConfig from '@/stores/helper/persist'

//   'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOjEwMDEsInJuU3RyIjoiZHE0bmdYUmYyZkp6ZkoxOWtDWjFtS1FjZ0RoblUwcnMiLCJ1c2VybmFtZSI6InpoYW5nIn0.TEkqh_la19K1mW7nZHThzms-mr76r49ttWa7zz2fsIU'
export const useUserStore = defineStore({
  id: 'jm-user',
  state: () => ({
    token: '',
    loginId: '',
    userInfo: { name: '', tokenName: 'satoken' }
  }),
  getters: {},
  actions: {
    // Set Token
    setToken(token) {
      this.token = token
    },
    setLoginId(loginId) {
      this.loginId = loginId
    },
    // Set setUserInfo
    setUserInfo(userInfo) {
      this.userInfo = userInfo
    }
  },
  persist: piniaPersistConfig('jm-user')
})
